#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2022/10/29 23:14
# @Author  : when
# @File    : test.py
# @Description :

from components.py_utils.dispatch.dispatch import func_dispatch


@func_dispatch
def dispatch1(args, **kwargs):
    raise Exception(f'{args[0]} not register111')


@func_dispatch
def dispatch2(args, **kwargs):
    raise Exception(f'{args[0]} not register222')


@dispatch1.register("test1")
def _(*args, **kwargs):
    print(f"{args[0]} test1-123")


@dispatch2.register("test2")
def _(*args, **kwargs):
    print(f"{args[0]} test2-123")


if __name__ == '__main__':
   dispatch1("test1", key1=1)
   dispatch2("test2", key1=2)
